package com.controller;

import com.dao.Employee;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

@Controller
@CrossOrigin(origins = "http://localhost:63342") // 指定允许的前端应用源
public class EmployeeController {
    @Resource
    Employee xs;


    @RequestMapping(value = "/list")
    @ResponseBody
    public Object test(HttpServletResponse response) {
        return xs.yuanGong();
    }

//dsafdfafadsadfs


    @RequestMapping( "/del")
    @ResponseBody
    public int test(int id, HttpServletResponse response) {
        return xs.del(id);
    }

    @RequestMapping( "/add")
    public int add(@RequestBody com.pojo.Employee employee, HttpServletResponse response) {
        return xs.add(employee);
    }
    @RequestMapping("/up")
    public int up(@RequestBody com.pojo.Employee employee,HttpServletResponse response){
     return xs.up(employee);
    }
}
